class Course < ActiveRecord::Base
  validates_presence_of :title
  validates_numericality_of :point
  validates_uniqueness_of :title
  
  protected
  def validate
  	errors.add(:point, "should be positive") if point.nil? || point <=0
  end
  
  belongs_to :teacher
end
